package com.bear.plan;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bear.PlatFormDao.plan.PlanDao;
import com.bear.PlatFormDao.plan.PlanDetailDao;
import com.bear.model.entity.plan.Plan;
import com.bear.model.entity.plan.PlanDetail;

@Service
public class PlanService {
	@Autowired
	private PlanDao plandaoImp;
	@Autowired
	private PlanDetailDao plandetaildaoImp;
	
	public List<Plan> getAllplansByUser(int userid)
	{
		return plandaoImp.getAllPlans(userid);
	}

	public void addPlan(Plan p) {
		plandaoImp.addPlan(p);
		
	}

	public List<PlanDetail> getAllPlanDetailsByPlanid(Integer planid) {
		
		return plandetaildaoImp.getPlanDetailByPlanid(planid);
	}

	public Plan getPlanById(Integer planid) {
		
		return plandetaildaoImp.getPlanById(planid);
	}

	public void addDetail(PlanDetail plandetail) {
		plandetaildaoImp.addDetail(plandetail);
		
	}

	public void updateComplete(Integer planid) {
		plandetaildaoImp.updateComplete(planid);
		
	}

	public void deleteDetail(int detailid) {
		plandetaildaoImp.deleteDetail(detailid);
		
	}
}
